﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public enum enumRuntime { Production, Development, Testing }

namespace WebLib
{
    public static class CProject
    {
        static string msCompanyID;
        static string msSystemID;
        static string msProjectID;
        static string msPathRoot;
        static string msPathWork;
        static string msPathTemp;
        public static enumRuntime mRuntime = enumRuntime.Production;
        public static CAction mAction = new CAction("CProject()");

        static DateTime mdStartTime;

        public static string CompanyID { get { return msCompanyID; } }
        public static string SystemID { get { return msSystemID; } }
        public static string ProjectID { get { return msProjectID; } }
        public static string PathProjectRoot { get { return msPathRoot; } }
        public static string PathProjectWork { get { return msPathWork; } }
        public static string PathProjectTemp { get { return msPathTemp; } }
        public static DateTime StartTime { get { return mdStartTime; } }
        static CProject()
        {
            mAction.Begin("CProject()");
            msCompanyID = "Company";
            msSystemID = "System";
            msProjectID = "Project";
            //todo: use map-path instead: msPathRoot = Application.StartupPath;
            //todo msPathWork = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            msPathTemp = @"c:\temp";  // todo

            mdStartTime = DateTime.Now;
        }

        public static void Begin()
        {
            // call from Global.asax
            // 京奇專案架構啟動點
//            msMsg = mdStartTime.ToString("yyyy,MM,dd,HH,mm,ss,fff");
            mAction.Begin("CProject()");
            CProject.AppendMsg("Begin() " + mdStartTime.ToString("yyyy,MM,dd,HH,mm,ss,fff"));
        }
        public static bool IsDebug
        {
            get { return mAction.IsDebug; }
            set { mAction.IsDebug = value; }
        }
        public static string Message
        {
            get { return mAction.Message; }
        }
        public static string MessageLog
        {
            get { return mAction.MessageLog; }
        }
        public static void ClearMsg()
        {
            mAction.ClearMsg();

        }
        public static void AppendMsg(string sMsg)
        {
            mAction.AppendMsg(sMsg);
        }
        public static void AppendMsgError(string sMsg)
        {
            mAction.AppendMsgError(sMsg);
        }

        public static void AppendMsgDebug(string sMsg)
        {
            if (IsDebug)
                mAction.AppendMsgDebug(sMsg);
        }

    }
}
